
import json
from ronglian_sms_sdk import SmsSDK


ACCID = "8aaf07087f77bf96017fe419867a392b"
AUTHTOKEN = "2d395ced59ab470c85d6a63222f8febb"
APPID = "8aaf07087f77bf96017fe41987703932"


# 短信验证码
def send_message(sms_code, mobile):

    sms_sdk = SmsSDK(accId=ACCID, accToken=AUTHTOKEN, appId=APPID)

    tid = '1'
    datas = (sms_code, '5')

    res = sms_sdk.sendMessage(tid, mobile, datas=datas)

    res_json = json.loads(res)

    if res_json.get('statusCode') == '000000':
        return sms_code
    else:
        return None





